// miniprogram/pages/index/index.js
var app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    // 轮播图地址
    imgUrls: ['https://6465-development-cid1-1304166209.tcb.qcloud.la/banner/banner2.png?sign=7f85a992b787f25dec1af3507e29c155&t=1605618455',
  'https://6465-development-cid1-1304166209.tcb.qcloud.la/banner/banner1.png?sign=057cd20bb53fcd86028aa09c482c007a&t=1605618478'],
    // 用户当前所在城市
    cityName:'',
    // 热门服务
    hotService:[{
      title:"分担家务",
      hotImg:[{
        src:"../../images/work/work2.png",
        dataCategory:"baojie",
        dataId:0
      },{
        src:"../../images/work/work1.png",
        dataCategory:"baomu",
        dataId:0
      }],
      housework:[{
        textContent:"白班保姆",
        dataCategory:"baomu",
        dataId:1
      },{
        textContent:"老人护理",
        dataCategory:"baomu",
        dataId:0
      },{
        textContent:"育儿师",
        dataCategory:"baomu",
        dataId:2
      }]
    }
    // ,{
    //   title:"家有萌宝",
    //   hotImg:[{
    //     src:"../../images/work/work2.png",
    //     dataCategory:"baojie",
    //     dataId:0
    //   },{
    //     src:"../../images/work/work1.png",
    //     dataCategory:"baomu",
    //     dataId:0
    //   }],
    //   housework:[{
    //     textContent:"护理新生儿",
    //     dataCategory:"baomu",
    //     dataId:2
    //   },{
    //     textContent:"制作辅食",
    //     dataCategory:"baomu",
    //     dataId:2
    //   },{
    //     textContent:"行为早教",
    //     dataCategory:"baomu",
    //     dataId:2
    //   }]
    // }
  ],
    /**
     * @param serviceTitle 服务的标题
     * @param items 具体项目服务 二维数组,每项表示一层
     */
    servicesList:[{
      serviceTitle:"居家保洁",
      items:[[{
        name:"定期保洁",
        iconClass:"icon-rili",
        category:"baojie",
        id:0
      },{
        name:"单次保洁",
        iconClass:"icon-baojiefuwu",
        category:"baojie",
        id:1
      },{
        name:"宠物保洁",
        iconClass:"icon-chongwu",
        category:"baojie",
        id:2
      }]]
    },{
      serviceTitle:"电器清洗",
      items:[[{
        name:"空调",
        iconClass:"icon-kongtiao",
        category:"dianqi",
        id:0
      },{
        name:"油烟机",
        iconClass:"icon-youyanjiicon small",
        category:"dianqi",
        id:1
      },{
        name:"中央空调",
        iconClass:"icon-gzhongyangkongtiao",
        category:"dianqi",
        id:2
      }],[{
        name:"洗衣机",
        iconClass:"icon-xiyiji",
        category:"dianqi",
        id:3
      },{
        name:"冰箱",
        iconClass:"icon-bingxiang",
        category:"dianqi",
        id:3
      },{
        name:"组合套餐",
        iconClass:"icon-zuhe",
        category:"dianqi",
        id:4
      }]]
    },{
      serviceTitle:"保姆月嫂",
      items:[[{
        name:"做饭保姆",
        iconClass:"icon-wancanhui",
        id:0,
        category:"baomu"
      },{
        name:"代班保姆",
        iconClass:"icon-shizhong",
        id:1,
        category:"baomu"
      },{
        name:"星级月嫂",
        iconClass:"icon-naiping",
        id:2,
        category:"baomu"
      }]]
    },{
      serviceTitle:"深度清洁",
      items:[[{
        name:"窗帘除尘",
        iconClass:"icon-chuanglian- Reduce",
        id:0,
        category:"qingjie"
      },{
        name:"床品除螨",
        iconClass:"icon-DoubleBed1x big",
        id:1,
        category:"qingjie"
      },{
        name:"窗户清洗",
        iconClass:"icon-chuanghu",
        id:2,
        category:"qingjie"
      }],[{
        name:"浴室清洁",
        iconClass:"icon-yugang",
        id:3,
        category:"qingjie"
      },{
        name:"厨房清洁",
        iconClass:"icon-ranqizaomeiqizaozaotaixianxing",
        id:4,
        category:"qingjie"
      },{
        name:"地板保养",
        iconClass:"icon-diban",
        id:5,
        category:"qingjie"
      }]]
    },{
      serviceTitle:"日式收纳",
      items:[[{
        name:"衣柜收纳",
        iconClass:"icon-yigui",
        id:0,
        category:"shouna"
      },{
        name:"橱柜收纳",
        iconClass:"icon-chugui",
        id:1,
        category:"shouna"
      },{
        name:"冰箱收纳",
        iconClass:"icon-bingxiang",
        id:2,
        category:"shouna"
      }]]
    }]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad:function (options) {
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
    this.setData({
      cityName:app.globalData.cityName
    })
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },
  // 页面跳转函数
  navigate:function(e){
    var category = e.currentTarget.dataset.category;
    var id = e.currentTarget.dataset.id;
    wx.navigateTo({
      url: `../servicePage/service?category=${category}&id=${id}`
    })
  },
  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})